import string
from random import randint
from random import choice


def solve():
    list = []
    n = int(input())
    m = int(input())
    for i in range(n):
        list.append("".join([choice(string.punctuation + string.digits) for i in range(1, randint(1, m) + 1)]))
    list.sort(key=len, reverse=True)
    print(list)


if __name__ == "__main__":
    solve()
